<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>个人资料</title>
		<link rel="stylesheet" type="text/css" href="btn_class.css" />
		<link rel="stylesheet" type="text/css"
			href="ext-2.2/resources/css/ext-all.css" />
		<link rel="stylesheet" type="text/css"
			href="ext-2.2/ext-2.2/style.css" />
		<link rel="stylesheet" type="text/css"
			href="ext-2.2/ext-2.2/desktop.css" />
		<link rel="stylesheet" type="text/css"
			href="ext-2.2/ext-2.2/ext-patch.css" />

		<script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script>
		<script type="text/javascript" src="ext-2.2/ext-all.js"></script>
		<script type="text/javascript" src="ext-2.2/gridToExcel.js"></script>

		<!--  	<script type="text/javascript" src="ext-2.2/source/locale/ext-lang-zh_CN.js"></script>   -->
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

		<script type="text/javascript">
		<%String uId = (String) session.getAttribute("Uid");
			if (uId == null || uId.equals("null")) {%>
			window.parent.location.href = 'index.jsp';
		<%}%>
	</script>
	</head>

	<script type="text/javascript">   
	Ext.BLANK_IMAGE_URL = "ext-2.2/resources/images/default/s.gif";
	var Jthtwb = Ext.data.Record.create( [ 
	{
		name : 'Uid',
		mapping : 'Uid',
		type : 'string'
	}, {
		name : 'Uemail',
		mapping : 'Uemail',
		type : 'string'
	}, {
		name : 'Uname',
		mapping : 'Uname',
		type : 'string'
	}, {
		name : 'Utelephone',
		mapping : 'Utelephone',
		type : 'string'
	}, {
		name : 'UcontactAdress',
		mapping : 'UcontactAdress',
		type : 'string'
	}, {
		name : 'Uzip',
		mapping : 'Uzip',
		type : 'string'
	}, {
		name : 'UwangwangNum',
		mapping : 'UwangwangNum',
		type : 'string'
	}, {
		name : 'UQQNum',
		mapping : 'UQQNum',
		type : 'string'
	}, {
		name : 'UmsnNum',
		mapping : 'UmsnNum',
		type : 'string'
	}, {
		name : 'Unote',
		mapping : 'Unote',
		type : 'string'
	}
	]);
	
	
	
Ext.onReady(function(){   
    var formPanel = new Ext.form.FormPanel({   
       	renderTo:Ext.getBody(),   
        labelAlign: 'right',   
        labelWidth: 60,   
        title: '个人基本信息',   
        width: '100%',   
        height : 400,
        border : false,
		reader : new Ext.data.JsonReader( {
			root : 'root'
		}, Jthtwb),
  		
        items: [
        	{  
        		columnWidth : .99,
				layout : "form",
				baseCls : "x-plain",
				labelWidth : 80, 
	     		items : [ 
	     		{
					xtype : 'textfield',
					fieldLabel : '姓名(拼音)',
					iconCls : 'bmenu',
					name : 'Uname',
					id:'Uname',
					allowBlank : false,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'numberfield',
					fieldLabel : '联系电话',
					iconCls : 'bmenu',
					name : 'Utelephone',
					id:'Utelephone',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'textfield',
					fieldLabel : '联系地址',
					iconCls : 'bmenu',
					name : 'UcontactAdress',
					id:'UcontactAdress',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'textfield',
					fieldLabel : '邮箱(登录名)',
					iconCls : 'bmenu',
					name : 'Uemail',
					id:'Uemail',
					allowBlank : false,
					emptyText : '',
					readOnly : true,            
					anchor : '98%'
				},{
					xtype : 'textfield',
					fieldLabel : '邮政编码',
					iconCls : 'bmenu',
					name : 'Uzip',
					id:'Uzip',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'textfield',
					fieldLabel : '阿里旺旺号',
					iconCls : 'bmenu',
					name : 'UwangwangNum',
					id:'UwangwangNum',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				},{
					xtype : 'textfield',
					fieldLabel : 'QQ号',
					iconCls : 'bmenu',
					name : 'UQQNum',
					id:'UQQNum',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'textfield',
					fieldLabel : 'MSN账号',
					iconCls : 'bmenu',
					name : 'UmsnNum',
					id:'UmsnNum',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}, {
					xtype : 'textarea',
					fieldLabel : '备注',
					iconCls : 'bmenu',
					name : 'Unote',
					id:'Unote',
					allowBlank : true,
					emptyText : '',
					anchor : '98%'
				}]
				}							 
				
        ],   
        buttons: [{
		text : '保存',
		iconCls : 'sy-sure',
		handler : function() {
			if (formPanel.form.isValid()) {
					var name = document.getElementById("Uname").value;
					var patterns =/^[a-zA-Z\s]+$/;
					if(!name.match(patterns)) 
					{ 
						alert("姓名只能是拼音!"); 
						return;
					} 
					
                    formPanel.form.submit( {
                        url : 'user!modify.do?Uid=<%=session.getAttribute("Uid")%>',
                        success : function(from, action) {
                            Ext.Msg.alert('信息', '保存成功!');
                        },
                        failure : function(form, action) {
                       		// Ext.MessageBox.alert('保存失败', '填写信息');
                        },
                        waitMsg : '正在保存数据，稍后...'
                    });
                } else {
                    Ext.Msg.alert('信息', '请填写完成再提交!');
                }
			
		}

	}]     
       		  });
       		  
       	formPanel.form.load({   
       		 method :"GET",
            waitTitle : "请稍候",   
            waitMsg : "正在加载表单数据，请稍候......",   
            url : 'user!getUserByUid.do',   
            success : function(form, action) {   
  					// Ext.MessageBox.alert('成功');   
            },   
            failure : function(form, action) {   
                Ext.MessageBox.alert('加载失败', "个人信息加载失败");   
            }   
        });     
  
});   



	
        </script>

	<body style="background:white">   
    </body> 
</html>
